﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Hotel2
{
    public partial class events : System.Web.UI.Page
    {
        private int ClickCount
        {
            get
            {
                if (Session["clickcount"] == null)
                { Session["clickcount"] = 0; return 0; }
                else
                    return (int)Session["clickcount"];
            }
            set
            {
                Session["clickcount"] = value;
            }
        }

        private int ClickCount2
        {
            get
            {
                if (Session["clickcount2"] == null)
                { Session["clickcount2"] = 0; return 0; }
                else
                    return (int)Session["clickcount2"];
            }
            set
            {
                Session["clickcount2"] = value;
            }
        }

        private int ClickCount3
        {
            get
            {
                if (Session["clickcount3"] == null)
                { Session["clickcount3"] = 0; return 0; }
                else
                    return (int)Session["clickcount3"];
            }
            set
            {
                Session["clickcount3"] = value;
            }
        }
                
        protected void Page_Load(object sender, EventArgs e)
        {
            eventOrderSuccess.Visible = false;
            Break.Visible = false;

            if (!IsPostBack)
            {
                ClickCount = 0;
                ClickCount2 = 0;
                ClickCount3 = 0;
            }
            
        }

        protected void Order_Click1(object sender, EventArgs e)
        {

            Break.Visible = true;
            eventOrderSuccess.Visible = true;

            if (ClickCount2 == 6)
            {
                eventOrderSuccess.Text = "Ticket cannot be added, only 6 tickets per event!";
            }
            else
            {
                int val = ClickCount;
                ClickCount = val + 1;
                ClickCount2++;
                eventOrderSuccess.Text = "Ticket successfully added to basket tickets avaliable";
            }

            orderedTickets1.Text = ClickCount2.ToString();

            ((master)this.Master).ChangeLabelTest(ClickCount.ToString());
        }

        protected void Order_Click2(object sender, EventArgs e)
        {

            Break.Visible = true;
            eventOrderSuccess.Visible = true;

            if (ClickCount3 == 6)
            {
                eventOrderSuccess.Text = "Ticket cannot be added, only 6 tickets per event!";
            }
            else
            {
                int val = ClickCount;
                ClickCount = val + 1;
                ClickCount3++;
                eventOrderSuccess.Text = "Ticket successfully added to basket tickets avaliable";
            }

            
            orderedTickets2.Text = ClickCount3.ToString();

            ((master)this.Master).ChangeLabelTest(ClickCount.ToString());
        }

        protected void venue1_Click(object sender, EventArgs e)
        {
            LinkButton lbtn = (LinkButton)sender;
            string id = lbtn.ID;
            Label1.Text = id;
        }
        
        protected void search_Click(object sender, EventArgs e)
        {
            Label1.Text = "Search Criteria for '"+SearchBox.Text+"'";
        }

        protected void Calendar1_SelectionChanged(object sender, EventArgs e)
        {
            Label1.Text = Calendar1.SelectedDate.ToShortDateString();
        }
    }
}